package com.company.action;

import org.apache.struts2.ServletActionContext;

import com.company.dao.PageProDao;
import com.company.entity.Accounts;
import com.company.service.AccountsService;
import com.company.service.PageProService;
import com.company.service.PageProjectService;

public class PageProjectAction extends BaseAction {

	PageProjectService pageProjectService;

	public PageProjectService getPageProjectService() {
		return pageProjectService;
	}

	public void setPageProjectService(PageProjectService pageProjectService) {
		this.pageProjectService = pageProjectService;
	}

	@Override
	public String execute() throws Exception {
		int pageNum = Integer.valueOf(ServletActionContext.getRequest()
				.getParameter("page"));
		int PageMaxnum = pageProjectService.queryPageNum();
		if (pageNum > PageMaxnum) {
			return SUCCESS;
		}
		ServletActionContext.getRequest().getSession()
				.setAttribute("PageMaxnum", PageMaxnum);
		ServletActionContext.getRequest().getSession()
				.setAttribute("ProList", pageProjectService.query(pageNum));
		return super.execute();
	}

}
